<template>
  <ele-multi-cascader clearable v-model="inputValue" :options="options"
    v-bind="{
    ...$attrs,
    separator: $attrs.placeholder || '>',
    placeholder: $attrs.placeholder || '请选择部门失误类型'
  }" v-on="$listeners"></ele-multi-cascader>
</template>

<script>
import inputValueMixin from '@/mixins/inputValueMixin'
import {
  getResponsibleDepartmentErrorTree,   // 城市tree结构
} from "@/api/workorder"
export default {
  name: 'DepartmentTypeCascader',
  mixins: [inputValueMixin],
  data() {
    return {
      options: [],
    };
  },
  methods: {
    getOptions() {
      getResponsibleDepartmentErrorTree().then(res => {
        this.options = (res.data || [])
        this.options.forEach((item, idnex) => {
          item.children && item.children.forEach((items, index) => {
            items.label = `${item.label}-${items.label}`
            items.value = `${item.value}:${items.value}`
          })
        })
        this.$emit('afterLoadOptions', {options: this.options})
      })
    },
    setOptions(options) {
      this.options = options
    },
  },
  created() {
    this.getOptions()
  }
};
</script>
<style lang="scss" scoped>

</style>